package com.honglv.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.honglv.pojo.entity.Commodities;

import com.honglv.pojo.dto.UpdateCommodityDTO;
import com.honglv.pojo.vo.GetAllCommoditiesVO;
import com.honglv.pojo.vo.GetCommodityVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommodityMapper extends BaseMapper<Commodities> {
    List<GetAllCommoditiesVO> getAllCommodities();

    GetCommodityVO getCommodity(@Param("id") Long id);

    List<GetAllCommoditiesVO> getCommoditiesByAuthorId(@Param("userId") Long userId);

    @Delete("DELETE FROM tb_commodities WHERE id = #{id}")
    Integer deleteCommodity(Long id);

    Integer updateCommodity(UpdateCommodityDTO updateCommodityDTO);
}
